
const apicontext = [
    '/mes/',
    '/msg/',
    '/pdcapi/',
    '/api/device/',
    '/deviceapiv2/',
    '/weixin/focusmachinestatus',
    '/leaseapi/',
    '/onlinehelp2/',
    '/weixin/',
    '/statistics/',
    '/controlapi/',
    '/friendapi/',
    '/ossapi/',
    '/experiment/',
    '/maintain/',
    '/capi/',
    '/ledger/',
    '/purchase/',
    '/inventorymanage/',
    '/customerarchivesapi/',
    '/diagnosis/',

    '/customroster',
    '/maintainctrl',
    '/maintainctrltest',
    '/dataanalysis',
    '/static/'
];
const proxyTable = {};
apicontext.forEach((key) => {
    proxyTable[key] = {
        target: 'https://mservice.weihong.com.cn/', // 'http://192.168.16.133',
        changeOrigin: true,
        secure: false
    };
});
const getPublicPath = () => {
    if (process.env.NODE_ENV === 'production') {
        return '/weibaoapp/';
    }
    return '/';
};

const publicPath = getPublicPath();

module.exports = {
    publicPath: publicPath,
    configureWebpack: {
        entry: {
            'intl.utils': 'intl-tel-input/build/js/utils.js'
        },
        externals: {
            BMap: 'BMap'
        }
    },
    runtimeCompiler: false,
    productionSourceMap: false,
    devServer: {
        proxy: {
            '/index.html#': {
                target: 'http://localhost:8080/index.html#',
                secure: false,
                ws: false
            },
            '/help/': {
                target: 'http://localhost:8080/help',
                secure: false,
                ws: false
            },

            ...proxyTable
        }
    },
    lintOnSave: 'default'
};
